home *** CD-ROM | disk | FTP | other *** search
/ BBS in a Box 4 / BBS in a Box - Macintosh - Volume IV (January 1992) (BBS in a Box).iso / Files / Prog / N-P / PASCALLOTTRY < prev    next >
Encoding:
Text File  |  1987-05-25  |  1.1 KB  |  70 lines  |  [TEXT/MACA]

  1. program Untitled;
  2.  
  3.  const
  4.   numbers = 39;
  5.  
  6.   output = 6;
  7.  
  8.  var
  9.   choice : array[0..6] of integer;
  10.   results : integer;
  11.   loop : integer;
  12.   times : integer;
  13.  
  14.  
  15.  procedure Sortarray;
  16.   var
  17.    index, spot, n : integer;
  18.  
  19.  begin
  20.   n := output;
  21.   for index := 2 to n do
  22.    begin
  23.     choice[0] := choice[index];
  24.     spot := index - 1;
  25.     while choice[spot] > choice[0] do
  26.      begin
  27.       choice[spot + 1] := choice[spot];
  28.       spot := spot - 1;
  29.      end;{while}
  30.     choice[spot + 1] := choice[0];
  31.    end {for}
  32.  end;
  33.  
  34.  procedure CheckArray;
  35.   var
  36.    count : integer;
  37.  
  38.  begin
  39.   for count := 1 to (results - 1) do
  40.    begin
  41.     if choice[results] = choice[count] then
  42.      results := results - 1;
  43.    end;
  44.  end;
  45.  
  46.  
  47. begin
  48.  times := 0;
  49.  
  50.  while times < 10 do
  51.   begin
  52.    results := 0;
  53.    randseed := tickcount;
  54.    while results < output do
  55.     begin
  56.      results := results + 1;
  57.      choice[results] := (random mod 39) + 1;
  58.      CheckArray;
  59.     end;
  60.  
  61.    SortArray;
  62.  
  63.    times := times + 1;
  64.    for loop := 1 to output do
  65.     begin
  66.      write(choice[loop]);
  67.     end;
  68.    writeln;
  69.   end;
  70. end.  times :=